/*
 Navicat Premium Data Transfer

 Source Server         : localhost2
 Source Server Type    : MySQL
 Source Server Version : 50635
 Source Host           : localhost
 Source Database       : ztp5

 Target Server Type    : MySQL
 Target Server Version : 50635
 File Encoding         : utf-8

 Date: 07/27/2019 14:58:12 PM
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `ven_chat_message_log`
-- ----------------------------
DROP TABLE IF EXISTS `ven_chat_message_log`;
CREATE TABLE `ven_chat_message_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `from_user_id` int(11) NOT NULL COMMENT '发布消息人',
  `action` int(4) DEFAULT NULL COMMENT '动作',
  `username` varchar(30) DEFAULT NULL COMMENT '用户名',
  `avatar` varchar(100) DEFAULT NULL COMMENT '用户头像',
  `shop_id` int(11) NOT NULL COMMENT '商户号',
  `to_user_id` int(11) NOT NULL COMMENT '接收消息的user_id',
  `created` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '消息时间',
  `is_shop` tinyint(1) NOT NULL COMMENT '0用户，1商家客服',
  `content` text COMMENT '内容',
  `type` enum('text','image') DEFAULT 'text',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=108 DEFAULT CHARSET=utf8 COMMENT='消息流水';

-- ----------------------------
--  Table structure for `ven_shop_service`
-- ----------------------------
DROP TABLE IF EXISTS `ven_shop_service`;
CREATE TABLE `ven_shop_service` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `shop_id` int(11) NOT NULL,
  `role_id` int(11) NOT NULL COMMENT 'shop_service_role表role_id',
  `shop_user_id` int(11) NOT NULL COMMENT '客服id',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态。1正常，0禁用',
  `created` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='商家客服表';

-- ----------------------------
--  Records of `ven_shop_service`
-- ----------------------------
BEGIN;
INSERT INTO `ven_shop_service` VALUES ('1', '1', '1', '2132', '1', '2019-07-27 09:46:13'), ('2', '1', '2', '3333', '1', '0000-00-00 00:00:00');
COMMIT;

-- ----------------------------
--  Table structure for `ven_shop_service_role`
-- ----------------------------
DROP TABLE IF EXISTS `ven_shop_service_role`;
CREATE TABLE `ven_shop_service_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `role_id` tinyint(2) NOT NULL COMMENT '角色权限id。目前 1是售前，2是售后，继续的数字往后加',
  `name` varchar(30) NOT NULL COMMENT '角色名称',
  `remark` varchar(100) NOT NULL COMMENT '备注',
  `status` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `ven_shop_service_role`
-- ----------------------------
BEGIN;
INSERT INTO `ven_shop_service_role` VALUES ('1', '1', '售前', '售前', '1'), ('2', '2', '售后', '售后', '1');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
